//
//  panAlertView.m
//  Daidou
//
//  Created by apple on 15/7/2.
//  Copyright (c) 2015年 pannir. All rights reserved.
//

#import "panAlertView.h"
#define kScreenWigth [UIScreen mainScreen].bounds.size.width
#define kScreenHeight [UIScreen mainScreen].bounds.size.height

@implementation panAlertView

+ (panAlertView *)sharedpanAlertView
{
    static panAlertView *actionView = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        actionView = [[panAlertView alloc] init];
    });
    
    return actionView;
}

-(id)init
{
    self=[super init];
    if (self) {
        self.userInteractionEnabled=YES;
        _background.userInteractionEnabled=YES;
        self.frame = CGRectMake(0, 0, kScreenWigth,kScreenHeight);
        _background=[[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenWigth,kScreenHeight)];
        _background.backgroundColor=[UIColor blackColor];
        _background.alpha=0.5;
        [self addSubview:_background];
        _buttomview=[[UIView alloc]initWithFrame:CGRectMake(10, kScreenHeight-100, kScreenWigth-20, 100)];
        _buttomview.layer.cornerRadius=20;
        _buttomview.backgroundColor=[UIColor whiteColor];
        [self addSubview:_buttomview];
//        UIButton *btn=[[UIButton alloc]initWithFrame:CGRectMake(100, 100, 100, 100)];
//        btn.backgroundColor=[UIColor redColor];
//        [btn addTarget:self action:@selector(tap) forControlEvents:UIControlEventTouchUpInside];
//        [self addSubview:btn];
        _tapGesture=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tap)];
        [self addGestureRecognizer:_tapGesture];
        
    }
    return self;
}

-(void)tap
{
//    [self.delegate backTaped];
}

+(void)show
{
   [[[UIApplication sharedApplication]keyWindow] addSubview:[panAlertView sharedpanAlertView]];

}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
